package com.dong.order.dao;

import com.dong.basic.po.OrderDetailPO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface OrderDetailDao {
    @Insert("insert into order_detail (status , address, account_id ,product_id, deliveryman_id, settlement_id,reward_id,price, date)" +
            "values (#{status},#{address},#{accountId},#{productId},#{deliverymanId},#{settlementId},#{rewardId},#{price},#{date})")
    @Options(useGeneratedKeys = true,keyProperty = "id")// 返回自动生成的id
    void insert(OrderDetailPO orderDetailPO);

    @Update("UPDATE order_detail set status = #{status}, address=#{address},account_id = #{accountId}," +
            "deliveryman_id = #{deliverymanId},settlement_id = #{settlementId},reward_id = #{rewardId},price=#{price}, date= #{date}" +
            "WHERE id = #{id}")
    void update(OrderDetailPO orderDetailPO);

    @Select("select id,status , address, account_id ,product_id, deliveryman_id, settlement_id,reward_id,price, date from order_detail  " +
            "WHERE id = #{id}")
    OrderDetailPO selectOrder(Integer id);

}


